//
//  EditUserInfoViewController.m
//  LiveStar
//
//  Created by 漪珊 on 2017/4/11.
//  Copyright © 2017年 apple. All rights reserved.
//

#import "EditUserInfoViewController.h"

@interface EditUserInfoViewController ()
@property (weak, nonatomic) IBOutlet UITextField *editTextField;

@end

@implementation EditUserInfoViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setNav];
    [self.editTextField becomeFirstResponder];
}

- (void)setNav {
    UIBarButtonItem *rightItem = [UIBarButtonItem itemWithTitle:@"保存" tintColor:[UIColor redColor] touchBlock:^{
        if (self.EditBlock&&self.editTextField.text.length) {
            self.EditBlock(self.editTextField.text,self.editType);
        }
    }];
    self.navigationItem.rightBarButtonItem = rightItem;
    switch (self.editType) {
        case EditTypeName:
            self.navigationItem.title = @"编辑昵称";
            break;
        case EditTypeAge:
            self.navigationItem.title = @"编辑年龄";
            break;
        case EditTypeAddress:
            self.navigationItem.title = @"编辑地址";
            break;
            
        default:
            break;
    }

}

- (void)CloseVC:(UIButton *)sender {
    [self dismissViewControllerAnimated:YES completion:nil];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
